<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Utils\QueryUtil;

class CreateTableAboutModuleAll extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_modules', function (Blueprint $table) {
            $table->id();
            $table->integer('cate_id')->default(0)->comment('项目分类ID project_cates.id');
            $table->integer('project_id')->default(0)->comment('项目ID projects.id');
            $table->integer('product_id')->default(0)->comment('产品ID products.id');
            $table->integer('p_id')->default(0)->comment('模块父级ID');
            $table->integer('level')->default(1)->comment('层级');
            $table->string('name', 128)->default('')->comment('模块名称');
            $table->string('remark', 255)->default('')->comment('模块说明');
            $table->string('note', 255)->default('')->comment('模块备注');
            $table->string('tags', 255)->default('')->comment('模块标签');
            $table->string('created_adminer')->default('')->comment('模块创建人 如 马文欢(17614322265)');
            $table->string('updated_adminer')->default('')->comment('模块最后修改人 如 马文欢(17614322265)');
            $table->integer('sort')->default(1)->comment('模块排序');
            $table->tinyInteger('enable')->default(1)->comment('上下架状态 1上架 0下架');
            $table->timestamps();

            $table->index('level');
            $table->index('cate_id');
            $table->index('project_id');
            $table->index('p_id');
            $table->index('product_id');
            $table->index('tags');
            $table->index('name');
        }); QueryUtil::tableComment('product_modules', '产品模块表');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('table_about_module_all');
    }
}
